package com.bckj.fastboot.upms.api.service;

import com.bckj.fastboot.core.lang.model.PageResult;
import com.bckj.fastboot.upms.api.constant.UpmsConstant;
import com.bckj.fastboot.upms.api.dto.UserAuthInfo;
import com.bckj.fastboot.upms.api.dto.UserQuery;
import com.bckj.fastboot.upms.api.dto.UserRequest;
import com.bckj.fastboot.upms.api.vo.UserVO;
import org.springframework.cloud.openfeign.FeignClient;

import org.springframework.web.bind.annotation.*;


import java.util.List;

/**
 * 用户表(User)remote
 *
 * @author wfc
 * @since 2023-09-14 16:05:24
 */
@FeignClient(value = UpmsConstant.SERVICE_ID, contextId = "user", path = "/user")
public interface UserRemoteService {

    /**
	 * 列表(分页)
	 *
	 * @param query req
	 * @return boolean
	 */
	@GetMapping("page")
	PageResult<UserVO> page(UserQuery query);
	
    /**
	 * 列表
	 *
	 * @param query req
	 */
	@GetMapping("list")
	List<UserVO> list(UserQuery query);
	
    /**
	 * 增加
	 *
	 * @param request req
	 * @return boolean
	 */
	@PostMapping()
	boolean save(@RequestBody UserRequest request);

	/**
	 * 修改
	 *
	 * @param request req
	 * @return boolean
	 */
	@PutMapping()
	boolean update(@RequestBody UserRequest request);

	/**
	 * 移除
	 *
	 * @param id id
	 * @return boolean
	 */
	@DeleteMapping("{id}")
	boolean remove(@PathVariable Long id);

	/**
	 * 详情
	 *
	 * @param id id
	 * @return vo
	 */
	@GetMapping("{id}")
	UserVO details(@PathVariable Long id);

	/**
	 * 根据手机号查询用户信息
	 * @param phone 手机号
	 * @return {@link UserAuthInfo}
	 */
	@GetMapping("findByPhone")
	UserAuthInfo findByPhone(@RequestParam("phone") String phone);
}
